<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    <div class="cont">
    </div>
    <input type="text" id="txt">
    <input type="button" id="btn" value="发送">
</body>
<script>

    var cont = document.querySelector(".cont");
    var txt = document.querySelector("#txt");
    var send = document.querySelector("#btn");

    send.onclick = function(){
        // 1. 创建元素
        var div = document.createElement("div");
        // 2. 设置内容
        div.innerText = txt.value;
        // 3. 插入页面
        cont.appendChild(div);
        // 4. 清空输入框
        txt.value = "";
    }
    
</script>
</html>